<template>
	<view class="content">
		<textarea maxlength="300" class="info" label-width="0" v-model="info" placeholder="请介绍一下自己,字数不超过300字"
			type="textarea"></textarea>
		<text>{{inputCount}}/300</text>
		
		<u-button @click="submit" :hair-line="false" :ripple="true" class="btn-auth">确定</u-button>
	</view>
</template>

<script>
	import apis from '@/apis.js'
	export default {
		data() {
			return {
				info: "",
			}
		},
		onLoad(options) {
			this.info = options.value
		},
		methods: {
			submit: function() {
				
				this.$http.post(apis.saveIntro, { intro: this.info }).then(res => {
					if (res.data.code === 200) {
						uni.showToast({
							title: '保存成功',
							icon: 'none'
						})
						setTimeout(() => {
							uni.switchTab({
								url: '/pages/tabbar/tabbar-5/tabbar-5'
							})
						}, 1000)
					}
				})
			}
		},
		computed: {
			inputCount: function() {
				return this.info.length;
			}
		}
	}
</script>

<style lang="scss">
	.content {
		display: flex;
		flex-flow: column;

		.info {
			width: 100%;
			height: 607rpx;
			padding: 10rpx;
			background: #EFF1F7;
			opacity: 1;
		}

		text {
			margin-top: 5rpx;
			margin-right: 16rpx;
			align-items: center;
			text-align: right;
		}
		
		
		.btn-auth {
			width: 308rpx;
			background: #3FA7FF;
			box-shadow: 0px 6rpx 12rpx rgba(0, 0, 0, 0.16);
			opacity: 1;
			border-radius: 4rpx;
			
			font-size: 31rpx;
			font-family: SimHei;
			font-weight: 400;
			line-height: 40rpx;
			color: #FFFFFF;
		}
	}
</style>
